﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WpfApp1.Servcies;

namespace WpfApp1
{
    /// <summary>
    /// TreeViewDemo1.xaml 的交互逻辑
    /// </summary>
    public partial class TreeViewDemo1 : Window
    {
        public TreeViewDemo1()
        {
            InitializeComponent();

            treeView1.ItemsSource = DeptService.List();
            treeView1.DisplayMemberPath = "Name";
            treeView1.SelectedValuePath = "Id";

            treeView1.SelectedItemChanged += (sender, e) => this.Title = treeView1.SelectedValue.ToString();
        }
    }
}
